// ActionScript file
import com.model.Model;

import flash.events.FullScreenEvent;

import mx.core.Application;


public var useDemoData:Boolean = false;
private var _app:Model = Model.getIntstance(); 

private function onCreationComplete():void {
	
	/* Set up full screen handler. */
    callLater(function ():void { Application.application.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler)});
    _app.addEventListener("bookChanged", Application.application.bookView.recreateBook);
}

private function fullScreenHandler(evt:FullScreenEvent):void {
    if (evt.fullScreen) {
        /* Do something specific here if we switched to full screen mode. */
    } else {
        /* Do something specific here if we switched to normal mode. */
    }
}

public function toggleFullScreen():void {
    try {
        switch (Application.application.stage.displayState) {
            case StageDisplayState.FULL_SCREEN:
                /* If already in full screen mode, switch to normal mode. */
                Application.application.stage.displayState = StageDisplayState.NORMAL;
                break;
            default:
                /* If not in full screen mode, switch to full screen mode. */
                Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;
                break;
        }
    } catch (err:SecurityError) {
        // ignore
    }
}

